package cn.wolfcode.wolf2w.vo;


import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

@Getter
public class TravelCondition {
	// 定义两个map封装数据,分别是天数和人均消费
	public static final Map<Integer,TravelCondition> DAY_TYPE = new HashMap<>();
	public static final Map<Integer,TravelCondition> PER_EXPEND_TYPE = new HashMap<>();
	// 在编译时加载到虚拟机中,在创建对象之前完成
	static {
		DAY_TYPE.put(1,new TravelCondition(0,3));
		DAY_TYPE.put(2,new TravelCondition(4,7));
		DAY_TYPE.put(3,new TravelCondition(8,14));
		DAY_TYPE.put(4,new TravelCondition(15,Integer.MAX_VALUE));

		PER_EXPEND_TYPE.put(1,new TravelCondition(1,999));
		PER_EXPEND_TYPE.put(2,new TravelCondition(1000,6000));
		PER_EXPEND_TYPE.put(3,new TravelCondition(6001,20000));
		PER_EXPEND_TYPE.put(4,new TravelCondition(20001,Integer.MAX_VALUE));
	}

	private Integer max;
	private Integer min;

	public TravelCondition(int min, int max) {
		this.max = max;
		this.min = min;
	}

	public static TravelCondition getDay(Integer day){
		return DAY_TYPE.get(day);
	}

	public static TravelCondition getPerExpend(Integer perExpend){
		return PER_EXPEND_TYPE.get(perExpend);
	}
}
